package com.feng.demo.jakartacommons.lang;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;

public class Mortgage{

	private int years;
	private float rate;

	public int getYears() { return this.years; }
	public void setYears(int years) { this.years = years; }

	public float getRate() { return this.rate; }
	public void setRate(float rate) { this.rate = rate; }

	public boolean equals(Object o){

		if(!(o instanceof Mortgage)){
			return false;
		}

		Mortgage m2 = (Mortgage)o;

		return new EqualsBuilder()
			.append(this.rate, m2.rate)
			.append(this.years, m2.years)
			.isEquals();
	}

	public String toString(){

		return new ToStringBuilder(this).
			append("rate", this.rate).
			append("years", this.years).
			toString();
	}
}